package com.ebring.shareEducation.service.impl;

import com.ebring.shareEducation.bean.ScoreOrder;
import com.ebring.shareEducation.dao.ScoreOrderMapper;
import com.ebring.shareEducation.service.ScoreOrderService;
import com.ebring.shareEducation.utils.RspMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ScoreOrderServiceImpl implements ScoreOrderService {

    @Autowired
    private ScoreOrderMapper scoreOrderMapper;

    /**
     * 获取用户积分交易流水
     * @param userId
     * @return
     */
    @Override
    public RspMsg scorePaymentWater(String userId) {
        RspMsg rspMsg = new RspMsg();
        List<ScoreOrder> scoreOrders = scoreOrderMapper.scorePaymentWater(userId);
        if(scoreOrders.size()>0){
            rspMsg.setOK();
            rspMsg.setResult(scoreOrders);
        }else{
            rspMsg.setError();
            rspMsg.setMsg("查询不到数据");
        }
        return rspMsg;
    }
}
